<!DOCTYPE html>

<head>

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

    <title>配件单管理</title>

    <link href="{:C('WEB_URL')}Public/admin/style/base.css" rel="stylesheet" type="text/css" />

    <link href="{:C('WEB_URL')}Public/admin/style/master.css" rel="stylesheet" type="text/css" />

    <script type="text/javascript" src="{:C('WEB_URL')}Public/admin/js/jquery1.9.1.js"></script>

    <script type="text/javascript" src="{:C('WEB_URL')}Public/admin/js/base.js"></script>

    

    <script type="text/javascript" src="{:C('WEB_URL')}Public/admin/My97/WdatePicker.js"></script>

    <script>

        function del(id){

            if(confirm('确定要删除记录吗?')){

                var url="{:C('WEB_URL')}/Admin/Auto/del/id/"+id;

                $.getJSON(url,function(data){

                    if(data['status']==1){

                        $(".list > tbody").children("#J_list"+data['data']).remove();

                    }else{

                        alert(data['info']);

                    }

           

                })

            }

        }



    </script>

	<style type="text/css">

	.box-info{position:absolute;top:0px;bottom:0;right:0px;left:0px;border:1px solid red;background-color:rgba(144,144,145,0.5);display:none}

	</style>

</head>

<body>

    <div id="wrapper">

        <h2>订单管理<!-- <a href="{:U('add')}" class="but_add">添加</a> --></h2>

        <table class="list">

            <thead>

			<!--筛选-->

		<form action="{:U('hzOrder')}" method="post" enctype="multipart/form-data">

			订单号:<input type='text' class='inputText' name='order_num' value="{$_REQUEST['order_num']}"/>

			用户手机号:<input type='text' class='inputText' name='name' value="{$_REQUEST['name']}"/>

			状态：<select name='type'>

						<option value='0'>--请选择--</option>	

						<option value='1' <?php if($_REQUEST['type'] == 1){ echo 'selected';} ?> >未支付</option>

						<option value='2' <?php if($_REQUEST['type'] == 2){ echo 'selected';} ?> >已支付</option>

						<option value='3' <?php if($_REQUEST['type'] == 3){ echo 'selected';} ?> >已完成服务</option>

					</select> 

			<input type='submit' value='搜索' class='btnOrange'>

		</form>

                <tr>

					<th>订单号</th><th>订单ID</th><th>订单名称</th><th>车主姓名</th><th>联系方式</th><th>车型</th>

					<th>订单金额</th><th>支付类型</th><th>订单类型</th>

					<th>下单时间</th><th>预约保养时间</th><th>订单状态</th><th>操作</th>

                </tr>

            </thead>

            <tbody>

            <volist name='list' id='vo'>

                <tr align="center" id="J_list{$vo.brand_id}">

                   <?php $time = array("1"=>"09:00-11:00","2"=>"11:00-13:00","3"=>"13:00-15:00","4"=>"15:00-17:00","5"=>"17:00-19:00","6"=>"19:00-21:00"); $sex = array("1"=>"先生","2"=>"女士"); ?>

                    <td>{$vo.order_num}&nbsp;</td>
                    <td>{$vo['order_id']}</td>
                    <td>{$vo.order_name}&nbsp;</td>

                    <td>{$vo.realname}&nbsp;<?php echo $sex[$vo['sex']]; ?></td>

					 <td>{$vo.username}&nbsp;</td>

					  <td>{$vo.brand_name}-{$vo.model_name}-{$vo.model_pl}-{$vo.model_year}&nbsp;</td>

                      <td>￥{$vo.all_price}&nbsp;元</td>

					<td><?php if($vo['pay_type']==1){echo '支付宝支付';}elseif($vo['pay_type']==2){echo '微信支付';}elseif($vo['pay_type']==3){echo 'POS支付';}else{echo '未支付';} ?></td>

					<td>

						<?php if($vo['uo_type'] == 1){echo '普通配件单';}elseif($vo['uo_type'] == 2){echo '特卖配件单';}else{echo '保养配件单';} ?>

					</td>

					<td><?php echo date('Y-m-d H:i:s',$vo['create_time']); ?>&nbsp;</td>

					<td>

						<?php if($vo['yy_date']){echo date('Y-m-d',$vo['yy_date']).' '.$time[$vo['yy_time']];}elseif($vo['status']!=60){  ?>

						<a href="javascript:caigou(<?php echo $vo['order_id']; ?>)">设置预约时间</a>

						<?php }else{echo '--';} ?>

					</td>                     

					<td><?php if($vo['status']<60 && $vo['status']>5){echo '正在保养';}elseif($vo['status']==60){echo '保养完成';}else{echo '未保养';} ?></td>

                    <td>

                        <empty name="_GET['id']"><a href="{:U('orderInfo',array('order_id'=>$vo['order_id']))}"  target="_bank" class="edit" >查看详情</a></empty>

                        <!--<a href="{:U('edit',array('id'=>$vo['brand_id']))}" class="edit" >编辑</a>

                        <span class="del hide" onClick="del({$vo.brand_id})">删除</span> -->

                    </td>

                </tr>

            </volist>

            </tbody>

        </table>

        <p class="hr_10"></p>

        <div class="pages">{$page} </div>

    </div>

	

	<div class='box-info'>

	</div>

	

	<!--显示框开始 -->

		<div id='caigouBox' style='position:absolute;top:0px;bottom:0px;left:0px;right:0px;border:1px solid red;background-color:rgba(000,000,000,0.5);display:none'>

				<div style='width:450px;height:300px; border:1px solid #FFF;border-radius:3px;background:#FFF; margin: 0 auto;margin-top:10%;'>

					<dl style='font-size:16px;'>

						<dt style='height:50px;text-align:center;background:#FF8247;line-height:50px; color:#FFF'><h3>预约时间设置</h3></dt>

						<dd style='height:65px;line-height:100px;padding-left:50px;'>

							<span>预约日期：</span>

							<input type="text" name="yy_date" readonly="readonly" onfocus="WdatePicker({startDate:'%y-%M-%d',dateFmt:'yyyy-MM-dd'})" class="inputText Wdate" />

						</dd>

						<dd style='height:65px;line-height:100px;padding-left:50px;'>

							<span>预约时间：</span>

							<select id='yy_time' style='width:170px;'>

								<option value='0'>--请选择--</option>	

								<option value='1'>09:00-11:00</option>

								<option value='2'>11:00-13:00</option>

								<option value='3'>13:00-15:00</option>

								<option value='4'>15:00-17:00</option>

								<option value='5'>17:00-19:00</option>

								<option value='6'>19:00-21:00</option>

							</select>

						</dd>

						<dd style='text-align:center;height:65px;line-height:65px;'><div>

							<input type='hidden' name='order_id'/>

							<input type='button' class='btnOrange' onclick="subCg();" value='提交'/>

							<input type='button' name='close' value='取消' style='margin-left:20px;' onclick ="$('#caigouBox').hide() "/>

							</div>

						</dd>

					</dl>

				</div>

		</div>

		<!--显示框结束-->	

<script type="text/javascript">

function caigou(id){	

	$("input[name=order_id]").val(id);

	$('#caigouBox').show();

}

function subCg(){

	var order_id = $("input[name=order_id]").val();

	var	yy_date = $('input[name=yy_date]').val();

	var	yy_time = $('#yy_time').val();

	if(yy_date==''){

		alert('预约日期不能为空!');

	}else if(yy_time==''){

		alert('预约时间不能为空!');

	}

	$.ajax({      

           type:"POST",      

           dataType:"json",      

           url:"{:U('time')}",

           data:{'order_id':order_id,'yy_date':yy_date,'yy_time':yy_time},    

           success:function(data){  

                 if(data == 1){

					alert('操作成功');

					location.href="{:U('hzOrder')}";

				 }else{

				 alert('失败');

				 }

               },                              

           });    

}

</script>

</body>

</html>